<script setup>
const earningMethods = [
  {
    id: 1,
    title: '学分认证',
    desc: '上传学习证书或成绩单，通过审核后获得相应学分',
    icon: '📝',
    color: '#FF9A3C',
    router:'/user-center/credit-certification'
  },
  {
    id: 2,
    title: '课程学习',
    desc: '完成指定课程学习并通过考核可获得学分',
    icon: '🎓',
    color: '#4D96FF',
    router:'/search-course'
  },
  {
    id: 3,
    title: '古诗词背诵',
    desc: '通过回答可直接获得学分奖励',
    icon: '📊',
    color: '#6BCB77',
    router:'/poetry-recitation'
  },
  {
    id: 4,
    title: '选择答题',
    desc: '每日累计答对五题获取10学分',
    icon: '👨‍🏫',
    color: '#845EC2',
    router:'/quiz'
  },
  {
    id: 5,
    title: '每日签到',
    desc: '完成签到可轻松获取10学分',
    icon: '🔧',
    color: '#FF6B6B',
    router:'/'
  },
  {
    id: 6,
    title: '论坛活动',
    desc: '通过知识分享、答疑解惑等方式获取学分，每日前五次发帖子或文章每次加五学分',
    icon: '💡',
    color: '#FFD166',
    router:'/forum'

  }
]
import { useRouter } from 'vue-router'
const router = useRouter()
const goTo = (path) => {
  router.push(path)
}
</script>

<template>
    <div class="earn-points-page">
        <h1 class="page-title">学分获取途径</h1>
        <p class="page-subtitle">选择适合您的方式积累学分，兑换丰富奖励</p>
        
        <div class="methods-grid">
            <div 
                class="method-card" 
                v-for="method in earningMethods" 
                :key="method.id"
                :style="{ '--card-color': method.color }"
            >
                <div class="card-icon">{{ method.icon }}</div>
                <h3 class="card-title">{{ method.title }}</h3>
                <p class="card-desc">{{ method.desc }}</p>
                <button class="card-button" @click="goTo(method.router)">立即获取</button>
            </div>
        </div>
    </div>
</template>

<style scoped>
.earn-points-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.page-title {
    text-align: center;
    font-size: 32px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
}

.page-subtitle {
    text-align: center;
    font-size: 16px;
    color: #666;
    margin-bottom: 40px;
}

.methods-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 25px;
}

.method-card {
    background-color: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border-top: 4px solid var(--card-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.method-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card-icon {
    font-size: 48px;
    margin-bottom: 20px;
    width: 80px;
    height: 80px;
    background-color: rgba(255, 154, 60, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--card-color);
}

.method-card:nth-child(1) .card-icon { background-color: rgba(255, 154, 60, 0.1); }
.method-card:nth-child(2) .card-icon { background-color: rgba(77, 150, 255, 0.1); }
.method-card:nth-child(3) .card-icon { background-color: rgba(107, 203, 119, 0.1); }
.method-card:nth-child(4) .card-icon { background-color: rgba(132, 94, 194, 0.1); }
.method-card:nth-child(5) .card-icon { background-color: rgba(255, 107, 107, 0.1); }
.method-card:nth-child(6) .card-icon { background-color: rgba(255, 209, 102, 0.1); }

.card-title {
    font-size: 20px;
    color: #333;
    margin-bottom: 12px;
    font-weight: 600;
}

.card-desc {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
    flex-grow: 1;
}

.card-button {
    background-color: var(--card-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    max-width: 150px;
}

.card-button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 992px) {
    .methods-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .methods-grid {
        grid-template-columns: 1fr;
    }
    
    .page-title {
        font-size: 26px;
    }
}
</style>